<?php
if(!defined('MIRAGE_MODE')) die('Forbidden');
/**
 * Description of Html
 * Date Created 09 1, 11 8:45:58 AM
 * @author Bryan Salazar
 */
class Html {
   public static function inputText($model,$attribute,$properties=array()) {
      $attr = self::getNameValue($model, $attribute);
      $input_attributes = self::getInputAttributes($attr,$properties);
      return '<input type="text" ' . $input_attributes . ' />';
   }
   
   public static function inputPassword($model,$attribute,$properties=array()) {
      $attr = self::getNameValue($model, $attribute);
      $input_attributes = self::getInputAttributes($attr,$properties);
      return '<input type="password" ' . $input_attributes . ' />';
   }
   
   public static function dropDown($model,$attribute,$list,$properties=array()) {
      $attr = self::getNameValue($model, $attribute);
      $html_attributes = self::getInputAttributes($attr,$properties);
      $select = '<select ' . $html_attributes . ' />';
//      return '<select></select>';
   }
   
   
   
   private static function getNameValue($model,$attribute) {
      if(!$model instanceof BaseModel) {
         throw new SystemException('');
      }
      $class_name = get_class($model);
      $name = $class_name . '[' . $attribute . ']';
      $attr = array(
          'name'  => $name,
          'value' => $model->$attribute
      );
      return $attr;
   }
   
   private static function getName($model, $attribute) {
      if(!$model instanceof BaseModel) {
         throw new SystemException('');
      }
      $class_name = get_class($model);
      $name = $class_name . '[' . $attribute . ']';
      $attr = array(
          'name'  => $name
      );
   }

   private static function getInputAttributes($attr,$properties) {
      $prop = array_merge($attr,$properties);
      $input_attributes = '';
      foreach($prop as $key => $val) {
         $input_attributes.= ' ' . $key . '="' . $val . '"';
      }
      return $input_attributes;
   }
}

?>
